<?php

class Zend_View_Helper_Blogs {

    function blogs() {
        $db = Zend_Db_Table::getDefaultAdapter();
        return $db->fetchAll(
                        $db->select()
                        ->from(array('b' => 'blogs'),
                                array('user_id'))
                        ->join(array('u' => 'users'),
                                'b.user_id = u.id')
                        ->where('u.disabled = ?', false)
                        ->order('u.username asc')
        );
    }
}